<?php

namespace app\admin\controller\gaokao;

use app\common\controller\Backend;

/**
 * 高考志愿咨询
 *
 * @icon fa fa-circle-o
 */
class Zhiyuan extends Backend
{
    
    /**
     * Zhiyuan模型对象
     * @var \app\common\model\gaokao\Zhiyuan
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\common\model\gaokao\Zhiyuan;
        $this->view->assign("typeList", $this->model->getTypeList());
        $this->view->assign("stuTypeList", $this->model->getStuTypeList());
        $this->view->assign("gradeList", $this->model->getGradeList());
        $this->view->assign("identyList", $this->model->getIdentyList());
        $this->view->assign("statusList", $this->model->getStatusList());
    }

    /**
     * 处理
     */
    public function deal($ids,$remark = ''){
        $row = $this->model->get($ids);

        if(!$row){
            $this->error("记录不存在");
        }

        if($row->status == '1'){
            $this->error("已经处理过了");
        }

        $row->status = '1';
        $row->remark = $remark;

        if($row->save() !== false){
            $this->success("处理成功");
        }

        $this->error("处理失败");
    }
}
